<import file="block/common.html" name="url"/>
<div class="layui-fluid">
    <div class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">局值班人</label>
            <div class="layui-input-inline">
                <input type="text" name="juname" lay-verify="required" lay-reqtext="局值班人不能为空" placeholder="请输入局值班人"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">处值班人</label>
            <div class="layui-input-inline">
                <input type="text" name="chuname" lay-verify="required" lay-reqtext="处值班人不能为空" placeholder="请输入处值班人"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">值班员</label>
            <div class="layui-input-inline">
                <input type="text" name="yuanname" lay-verify="required" lay-reqtext="值班员不能为空" placeholder="请输入值班员"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">值班电话</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" lay-verify="required" lay-reqtext="值班电话不能为空" placeholder="请输入值班电话"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">值班时间</label>
            <div class="layui-input-inline">
                <input id="datetime" type="text" name="ondutytime" lay-verify="required" lay-reqtext="值班时间不能为空" placeholder="请输入值班时间职务" value="" class="layui-input" autocomplete = "off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">值班人状态</label>
            <div class="layui-input-inline">
                <input type="radio" name="status" value="1" title="在岗">
                <input type="radio" name="status" value="0" title="离岗" checked>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="saveBtn"><?php echo lang('save');?></button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'table','laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate,
            $ = layui.$;
			
		laydate.render({
			elem:'#datetime'
			,type:'date'
		});
		
		form.render();

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.post('<{caUrl("onduty","add")}>', data.field, function (res) {
                if (res.status == 1) {
                    layer.msg(res.info, { icon: 1, time: 1000 }, function () {
                        loadMain('<{caUrl("onduty","index")}>');
                    });
                } else {
                    layer.msg(res.info, { icon: 2, anim: 6, time: 5000 });
                }
            });
            return false;
        });

    });
</script>